package cate.game.play.skill.passive.talent;

import cate.common.util.XT;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.skill.passive.PassiveHandler;

/**
 * 死亡时，有55%概率恢复全队15%生命值
 */
public class 殉道PH extends PassiveHandler {

	private int 概率;

	private int buff;


	//概率=5500&buff=??
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		概率 = args.getInt("概率", 0);
		buff = args.getInt("buff", 0);
	}

	@Override
	public void onDead(ActionCtx action, Fighter killer) {
		if (!XT.chance(概率)) {
			return;
		}
		for (Fighter target : skill.owner.getFightTeam().getFriendsAlive(skill.owner)) {
			target.buff.tryAddByTid(action, skill.owner, buff);
		}
	}
}
